package com.kaka.bus.engine.home.info.opinion;

import com.kaka.bus.bean.HttpWrapper;
import com.kaka.bus.di.DataManager;
import com.kaka.bus.manager.Result;
import com.kaka.bus.manager.T;
import com.kaka.bus.mvp.RxPresenter;

import javax.inject.Inject;

/**
 * Created by zhangqi on 2016/10/27.
 */

public class OpinionPresenter extends RxPresenter<OpinionContract.View> implements OpinionContract.Presenter{

    @Inject
    public OpinionPresenter(DataManager dataManager) {
        super(dataManager);
    }

    @Override
    public void commitOpinion(String userId,String token,String opinion) {
        addSubscribe(mDataManager
                .getApi()
                .userFeedBack(userId,opinion,token)
                .compose(T.D())
                .subscribeWith(new Result<HttpWrapper<String>>() {
                    @Override
                    protected void onSuccess(HttpWrapper<String> data) {
                        mView.commitSuccess(data);
                    }
                }));

    }
}
